import request from 'axios'
import {publicNetworkIpAndPort} from "./globalVar";

export function login(params) {
  return request({
    url: publicNetworkIpAndPort() + '/api/user/login',
    headers: {
      'Content-Type': 'application/json',
    },
    method: 'post',
    data: params
  })
}


export function getAllEnergey(params) {
  return request({
    url: publicNetworkIpAndPort() + '/api/energyConsumption/getAllEnergyConsumption',
    method: 'get',
    params: params
  })
}

export function getAllEmission(params) {
  return request({
    url: publicNetworkIpAndPort() + '/api/carbonEmission/getAllCarbonEmission',
    method: 'get',
    params: params
  })
}

export function searchEnergyByName(params) {
  return request({
    url: publicNetworkIpAndPort() + '/api/energyConsumption/getAllEnergyConsumption',
    method: 'get',
    params: params
  })
}
export function searchCarbonByName(params) {
  return request({
    url: publicNetworkIpAndPort() + '/api/carbonEmission/getAllCarbonEmission',
    method: 'get',
    params: params
  })
}

export function getCarbonLine(params) {
  return request({
    url: publicNetworkIpAndPort() + '/api/carbonEmission/listBuildingCarbonLine',
    method: 'get',
    params: params
  })
}

export function getCarbonBuilding(params) {
  return request({
    url: publicNetworkIpAndPort() + '/api/carbonEmission/listBuildingCarbonBar',
    method: 'get',
    params: params
  })
}

export function getCarbonTable(params) {
  return request({
    url: publicNetworkIpAndPort() + '/api/carbonEmission/listBuildingInfo',
    method: 'get',
    params: params
  })
}
